package cn.wolfcode.crm.domain;

import com.alibaba.fastjson.JSON;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.HashMap;

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class Courseorder {
    private Long id;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date inputTime;
    private Customer customer;
    private SystemDictionaryItem course;

    private Long money;

    //把部门转为json字符串
    public String getJson(){
        HashMap map = new HashMap();
        map.put("id",id);
        map.put("customerId",customer);
        map.put("courseId",course);
        map.put("money",money);
        //不能直接传this进去,会出现死循环
        return JSON.toJSONString(map);
    }
}